<?php

namespace App\Models\Relations;

use App\Models\ImUserCurrent;

trait ImUserHasCurrent
{
    public static function bootImUserHasCurrent()
    {
        // 用户创建后事件
        static::created(function ($user) {
            $info = ImUserCurrent::firstOrCreate(
                ['user_id' => $user->id]
            );

            if ($info === false) {
                return false;
            }
        });
    }
}
